package com.house.service;

import com.house.entity.News;
import com.house.mapper.NewsMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewsService {
    @Autowired
    private NewsMapper newsMapper;

    public void insertOne(int houseId,int userId,String telphone,String price,String inf){
        newsMapper.insertOne(userId,houseId,price,inf,telphone);
    }

    public List<News> findAllByHouseId(int houseId){
        return newsMapper.findAllByHouseId(houseId);
    }
    public List<News> findAllByUserId(int userId){
        return newsMapper.findAllByUserId(userId);
    }
    public News findById(int id){
        return newsMapper.findById(id);
    }

    public void deleteById(int id){
        newsMapper.deleteById(id);
    }
}
